package com.ms.education.statistics.jobs;

import com.dangdang.ddframe.job.api.ShardingContext;
import com.dangdang.ddframe.job.api.dataflow.DataflowJob;

import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * <p>Project:我的代码-MyDataflowJob
 * <p>Powered by ms on 2023-02-11 19:58:42
 *
 * @author ms
 * @version 1.0
 * @since 1.8
 */
public class MyDataflowJob implements DataflowJob<String> {

    @Override
    public List<String> fetchData(ShardingContext shardingContext) {
        System.out.println("拉取数据中====");
        try {
            TimeUnit.SECONDS.sleep(3);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("拉取数据完毕=====");
        return null;
    }

    @Override
    public void processData(ShardingContext shardingContext, List<String> list) {
        System.out.println("处理数据中============");
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("处理数据完毕=====");
    }
}
